<template>
	<!--
    	作者：1550495493@qq.com
    	时间：2019-08-15
    	描述：专家库
    -->
	<div class="PressRelease">
		<div class="search-box">
			<div class="fl">
				<input @click="manually" class="btn-boxs" type="button" value="人工录入" />
				<input class="btn-boxs" type="button" value="数据导入" @click="$refs.inputFile.click()"/>
        <input type="file" ref="inputFile" accept=".xls,.xlsx" style="display: none" @change="inputData"/>
				<input class="btn-boxs" type="button" value="数据导出" @click="exportData"/>
			</div>
			<div class="fr">
				<select class="search" id="searchName" name="queryType" v-model="queryType">
					<option value="expertName">姓名</option>
					<option value="theWork">身份证号</option>
					<option value="expertUnit">所在单位</option>
					<option value="secondLevel">二级学科</option>
					<option value="professionalSkillDuty">专业技术职务</option>
				</select>
				<input class="search" type="text" name="content" v-model="content" />
				<input type="button" value="搜索" class="btn" @click="queryPageExperts()" />
			</div>
		</div>
		<div class="PressRelease-list">
			<table>
				<thead>
					<tr>
						<th class="table-text-th1">专家姓名</th>
						<th class="table-text-th1">身份证号</th>
						<th class="table-text-th1">所在单位</th>
						<th class="table-text-th2">二级学科</th>
						<th class="table-text-th1">专业技术职务</th>
						<th class="table-text-th1">手机号码</th>
						<th class="table-text-th1">邮箱</th>
						<th class="table-text-th3">操作</th>
					</tr>
				</thead>
				<tbody>
					<tr v-if="!total">
						<td colspan="8">暂无数据</td>
					</tr>
					<tr v-for="(list,index) in expertInfo" :class="index==curIndex?'activeBg':''" @click="choosed(index)">
						<td :title="list.expertName"><span class="show-oneline-table">{{list.expertName}}</span></td>
						<td :title="list.theWork"><span class="show-oneline-table">{{list.theWork}}</span></td>
						<td :title="list.expertUnit"><span class="show-oneline-table">{{list.expertUnit}}</span></td>
						<td :title="list.secondLevel"><span class="show-oneline-table">{{list.secondLevel}}</span></td>
						<td :title="list.professionalSkillDuty"><span class="show-oneline-table">{{list.professionalSkillDuty}}</span></td>
						<td :title="list.phoneNumber"><span class="show-oneline-table">{{list.phoneNumber}}</span></td>
						<td :title="list.email"><span class="show-oneline-table">{{list.email}}</span></td>
						<td><input @click="manually(list)" type="button" value="修改" class="delete write" />
							<input @click="toView(list)" type="button" value="查看" class="delete write" /></td>
					</tr>
				</tbody>
			</table>
			<!--total  数据总数   size  一页多少条数据   page  当前页码    changge 返回当前选择的页码  改变一页显示条 child  返回值就是一页显示条数  -->

		</div>
		<pageination :total="total" :size="size" :page="page" :changge="pageFn" @child="obtainChild"></pageination>
		<!-- 人工录入-模态框-->
		<div v-show="ApplicationStatus" class="tenant-model">
			<div class="tenant-model-content Application">
				<header class="tenant-model-header">
					<h3 v-if="!isModify">人工录入</h3>
					<h3 v-if="isModify">修改</h3>
					<span @click="closeModel" class="closeModel">×</span>
				</header>
				<div class="tenant-model-body">
					<div class="search-contain">
						<!--模态框内容板块-->
						<form class="form-box" id="expertsForm">
							<div class="form-line input-required">
								<label>姓名：</label>
								<div class="input-box">
									<input id="expertName" name="expertName" type="text" v-model="newOrUpdate.expertName">
								</div>
							</div>
							<div class="form-line input-required">
								<label>身份证号：</label>
								<div class="input-box">
									<input id="theWork" name="theWork" v-model="newOrUpdate.theWork">
								</div>
							</div>
							<div class="form-line input-required">
								<label>性别：</label>
								<div class="input-box">
									<select id="expertGender" name="expertGender">
										<option :selected="expertGender == '男'" value="男">男</option>
										<option :selected="expertGender == '女'" value="女">女</option>
									</select>
								</div>
							</div>
							<div class="form-line input-required">
								<label>所在单位：</label>
								<div class="input-box">
									<input id="expertUnit"  name="expertUnit" ype="text" v-model="newOrUpdate.expertUnit">
								</div>
							</div>
							<div class="form-line input-required">
								<label>导师类别：</label>
								<div class="input-box">
									<input id="tutorClasses" name="tutorClasses" type="text" v-model="newOrUpdate.tutorClasses">
								</div>
							</div>
							<div class="form-line input-required">
								<label>一级学科：</label>
								<div class="input-box">
									<input id="firestLevel" name="firestLevel" type="text" v-model="newOrUpdate.firestLevel">
								</div>
							</div>
							<div class="form-line input-required">
								<label>二级学科：</label>
								<div class="input-box">
									<input id="secondLevel" name="secondLevel" type="text" v-model="newOrUpdate.secondLevel">
								</div>
							</div>
							<div class="form-line ">
								<label>党政职务：</label>
								<div class="input-box">
									<input id="partyPolicyDuty" name="partyPolicyDuty" type="text" v-model="newOrUpdate.partyPolicyDuty">
								</div>
							</div>
							<div class="form-line">
								<label class="form-line-label professional-duties">专业技术职务：</label>
								<div class="input-box professional-duties-box">
									<input id="professionalSkillDuty" name="professionalSkillDuty" type="text" v-model="newOrUpdate.professionalSkillDuty">
								</div>
							</div>
							<!--<div class="form-line">
								<label class="form-line-label">专业技术职务级别：</label>
								<div class="input-box form-line-box">
									<input id="professionalSkillDutyLevel" name="professionalSkillDutyLevel" type="text" v-model="newOrUpdate.professionalSkillDutyLevel">
								</div>
							</div>-->
							<div class="form-line input-required">
								<label>手机号码：</label>
								<div class="input-box">
									<input id="phoneNumber" type="text" name="phoneNumber" v-model="newOrUpdate.phoneNumber">
								</div>
							</div>
							<div class="form-line input-required">
								<label>电子邮箱：</label>
								<div class="input-box">
									<input id="email" type="text" name="email" v-model="newOrUpdate.email">
								</div>
							</div>
							<div class="search-boxs imgbox">
								<label>专家头像：</label>
								<div class="imgbtn">
                  <input type="hidden" name="headPortrait"   v-model="headPortrait"/>
									<input type="file" id="handIdFront" accept="image/*" @change="idFrontImg($event)" style="display: none;" />
									<img class="showHandIdFront" id="imgHand"   />
									<a class="Public-btn1 uploadbtn again-upload " @click="touchOffIdInput(1)">重新上传</a>
									<a class="Public-btn1 uploadbtn handIdFrontA " @click="touchOffIdInput(1)">上传</a>
								</div>
							</div>
              <input type="reset" style="display: none"/>
						</form>
						<div class="tab-tit">
							<a href="javascript:;" @click="curId=0" :class="{'cur':curId===0}">文本</a>
							<a href="javascript:;" @click="curId=1" :class="{'cur':curId===1}">图像</a>
							<a href="javascript:;" @click="curId=2" :class="{'cur':curId===2}">音视频</a>

						</div>

						<div class="tab-con">
							<div v-show="curId===0">

								<table>
									<tr>
										<th>文本名称</th>
										<th>上传时间</th>
										<th>操作</th>
										<!--<th>下载</th>-->
									</tr>
									<tr v-for="(list,ind) in type0">
										<td>{{list.name}}</td>
										<td>{{formatData(list.createAt)}}</td>
										<td>
											<input type="button" value="删除" class="delete" @click="deleteResources(list.expertId,list.id,list.uuid, type0)" />
										</td>
									</tr>
								</table>
								<div>
									<button class="upload-img" @click="uploadFileMiddle(1)">上传</button>
									<input value="上传" class="upload-img1"  id="textFile" @change="uploadFile(0,$event)" name="file" type="file" multiple=false accept=".doc,.docx,.xls,.xlsx,.pdf,.html,.txt" style="display: none"/>
								</div>
							</div>
							<div v-show="curId===1">

								<table>
									<tr>
										<th>文本名称</th>
										<th>上传时间</th>
										<th>操作</th>
										<!--<th>下载</th>-->
									</tr>
									<tr v-for="(list,ind) in type1">
										<td @click="downloadResources(list.url)">{{list.name}}</td>
                    <td>{{formatData(list.createAt)}}</td>
										<td>
											<input type="button" value="删除" class="delete" @click="deleteResources(list.expertId,list.id,list.uuid, type1)" />
										</td>
									</tr>
								</table>
								<div>
									<button class="upload-img" @click="uploadFileMiddle(2)">上传</button>
									<input value="上传"  class="upload-img2" id="textFile" @change="uploadFile(1,$event)" name="file" type="file" multiple=false accept="image/*"  style="display: none;" /></div>
							</div>
							<div v-show="curId===2">

								<table>
									<tr>
										<th>文本名称</th>
										<!--<th>文本格式</th>-->
										<th>上传时间</th>
										<th>操作</th>
										<!--<th>下载</th>-->
									</tr>
									<tr v-for="(list,ind) in type2">
										<td>{{list.name}}</td>
                    <td>{{formatData(list.createAt)}}</td>
										<td>
											<input type="button" value="删除" class="delete" @click="deleteResources(list.expertId,list.id,list.uuid, type2)" />
										</td>
									</tr>
								</table>
								<div>
									<button class="upload-img" @click="uploadFileMiddle(3)">上传</button>
									<input value="上传"  class="upload-img3" id="textFile" @change="uploadFile(2,$event)" name="file" type="file" multiple=false  accept="video/*"  style="display: none;" /></div>
							</div>
						</div>

					</div>
				</div>
				<footer class="tenant-model-footer">

          <button class="determine" v-if="isModify" @click="newOrUpdateExpert">保存</button>
          <button class="determine" v-else @click="newOrUpdateExpert">确认</button>
        </footer>
			</div>
		</div>
		<!--查看-模态框-->
		<div v-if="Application" class="tenant-model">
			<div class="tenant-model-content ApplicationStatus">
				<header class="tenant-model-header">
					<h3>查看</h3>
					<span @click="closeModel" class="closeModel">×</span>
				</header>
				<div class="tenant-model-body">
					<div class="search-contain">
						<!--模态框内容板块-->
						<form class="form-box">
							<div class="form-line ">
								<label>姓名：</label>
								<div class="input-box">
									{{toExpertView.expertName}}
								</div>
							</div>
							<div class="form-line ">
								<label>身份证号：</label>
								<div class="input-box">
									{{toExpertView.theWork}}
								</div>
							</div>
							<div class="form-line ">
								<label>性别：</label>
								<div class="input-box">
									{{toExpertView.expertGender }}
								</div>
							</div>
							<div class="form-line ">
								<label>所在单位：</label>
								<div class="input-box">
									{{toExpertView.expertUnit}}
								</div>
							</div>
							<div class="form-line ">
								<label>导师类别：</label>
								<div class="input-box">
									{{toExpertView.tutorClasses}}
								</div>
							</div>
							<div class="form-line ">
								<label>一级学科：</label>
								<div class="input-box">
									{{toExpertView.firestLevel}}
								</div>
							</div>
							<div class="form-line ">
								<label>二级学科：</label>
								<div class="input-box">
									{{toExpertView.secondLevel}}
								</div>
							</div>
							<div class="form-line ">
								<label>党政政务：</label>
								<div class="input-box">
									{{toExpertView.partyPolicyDuty}}
								</div>
							</div>
							<div class="form-line">
								<label class="professional-duties">专业技术职务：</label>
								<div class="input-box professional-duties-box">
									{{toExpertView.professionalSkillDuty}}
								</div>
							</div>
							<div class="form-line">
								<label class="form-line-label">专业技术职务级别：</label>
								<div class="input-box form-line-box">
									{{toExpertView.professionalSkillDutyLevel}}
								</div>
							</div>
							<div class="form-line ">
								<label>手机号码：</label>
								<div class="input-box">
									{{toExpertView.phoneNumber}}
								</div>
							</div>
							<div class="form-line">
								<label>电子邮箱：</label>
								<div class="input-box">
									{{toExpertView.email}}
								</div>
							</div>

						</form>
						<div class="search-boxs imgbox">
								<label>专家头像：</label>
								<div class="imgbtn">
									<img id="heads" :src="headPortrait" />
								</div>
							</div>
						<div class="tab-tit">
							<a href="javascript:;" @click="curId=0" :class="{'cur':curId===0}">文本</a>
							<a href="javascript:;" @click="curId=1" :class="{'cur':curId===1}">图像</a>
							<a href="javascript:;" @click="curId=2" :class="{'cur':curId===2}">音视频</a>
						</div>
						<div class="tab-con">
							<div v-show="curId===0">
								<table>
									<tr>
										<th>文本名称</th>
										<th>查看</th>
										<th>下载</th>
									</tr>
									<tr v-for="(list,ind) in type0">
										<td>{{list.name}}</td>
										<td>
											<input type="button" @click="toSrc(list.url)" value="查看" class="delete" />
										</td>
										<td>
											<input type="button" @click="downloadResources(list.url)" value="下载" class="delete" />
										</td>
									</tr>
								</table>
							</div>
							<div v-show="curId===1">
								<table>
									<tr>
										<th>文本名称</th>

										<th>查看</th>
										<th>下载</th>
									</tr>
									<tr v-for="(list,ind) in type1">
										<td>{{list.name}}</td>
                    <td>
                      <input type="button" @click="toSrc(list.url)" value="查看" class="delete" />
                    </td>
                    <td>
                      <input type="button" @click="downloadResources(list.url)" value="下载" class="delete" />
                    </td>
									</tr>
								</table>
							</div>
							<div v-show="curId===2">
								<table>
									<tr>
										<th>文本名称</th>
										<th>查看</th>
										<th>下载</th>
									</tr>
									<tr v-for="(list,ind) in type2">
										<td>{{list.name}}</td>
                    <td>
                      <input type="button" @click="toSrc(list.url)" value="查看" class="delete" />
                    </td>
                    <td>
                      <input type="button" @click="downloadResources(list.url)" value="下载" class="delete" />
                    </td>
									</tr>
								</table>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>

	</div>
</template>
<script src="./ExpertDatabase.js"></script>

<style scoped>
	@import "ExpertDatabase.css";
</style>
